package com.zhentao.controller;

import com.zhentao.service.CityService;
import com.zhentao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/city")
public class CityController {
    @Autowired
    private CityService cityService;
    @RequestMapping("findByLevel")
    public Result findByLevel(){
        return Result.OK(cityService.findByLevel(0));
    }

    @RequestMapping("findByCid")
    public Result findByCid(@RequestParam("city_id") Integer cityId){
        return Result.OK(cityService.findByCid(cityId));
    }
}


